const Koa=require('koa');
const koaBody=require('koa-body');
const Static=require('koa-static');
const logger=require('koa-logger');
const path=require('path');
const nunjucks=require('koa-nunjucks-2');

var app=new Koa();

app.use(logger());
app.use(Static(path.join(__dirname,'static')));
app.use(nunjucks({
	ext:'html',
	path:path.join(__dirname,'views'),
	nunjucksConfig:{
		trimBlocks:true
	}
}));

app.use(koaBody());

app.use(require('./routes/index.js').routes());
app.use(require('./routes/api.js').routes())

app.listen(3000);

console.log('Listening on port 3000...');